/**
 * 自定义 token 操作
 */
import settings from '@/common/config/settings';

/**
 * 获取本地Token
 */
export const getToken = async () => {
  return await uni.getStorageSync(`${settings.siteTokenKey}`);
};

/**
 * 设置存储本地Token
 */
export const setToken = async (token) => {
  try {
    await uni.setStorageSync(settings.siteTokenKey, token);
    return true;
  } catch (error) {
    return false;
  }
};

/**
 * 移除本地Token
 */
export const removeToken = async() => {
  try {
    await uni.removeStorageSync(`${settings.siteTokenKey}`)
    return true;
  } catch (error) {
    return false;
  }
};